import $request from '../../utils/request'

//异步请求post对象方法封装
export function postObjMx(url, params = null) {
  return $request.post(url, params).then(res => res.data);
};
//异步请求post函数方法封装
export function postFnMx(url, params = null) {
  return $request({
    url: url,
    method: "post",
    data: params
  }).then(res => res.data);
}
//异步请求get对象方法封装
export function getObjMx(url, params = null) {
  if (params) {
    return $request.get(`${url}?${qs.stringify(params)}`).then(res => res.data);
  } else {
    return $request.get(`${url}`).then(res => res.data);
  }
}
//异步请求get函数方法封装
export function getFnMx(url, params = null) {
  if (params) {
    return $request({
      url,
      method: "get",
      params: params
    }).then(res => res.data);
  } else {
    return $request({
      url,
      method: "get"
    }).then(res => res.data);
  }
}
//页面简单跳转
export function jumpMx(url, parms = null) {
  if ($router.app.$route.path == url) return;
  $router.push({
    path: url
  });
}